<?php

include("categorySelection.php");
?>
<center>
<br/><br/><br/><br/>
 <form action="<?php $_SERVER["PHP_SELF"]?>" method="post" >
 <table>
    <tr>
        <td colspan=3 align=center>
                <h2>
                  <p style="color:blue">AddGame</p>
                </h2>
        </td>
    </tr>
    <tr>
        <td>
            Title:
        </td>
        <td width=20>
        </td>
        <td>
            <input type="text" name="title">
        </td>
    </tr>
    <tr>
        <td align=top>
            ImagePath:
        </td>
                <td width=20>
        </td>
        <td>
            <input type="text" name="imagepath">     
        </td>
    </tr>
    <tr>
        <td align=top>
            ReleaseDate:
        </td>
                <td width=20>
        </td>
        <td>
            <input type="text" name="releasedate">     
        </td>
    </tr>
    <tr>
        <td align=top>
            Review:
        </td>
                <td width=30>
        </td>
        <td>
            <input type="text" name="review" size="40">     
        </td>
    </tr>
       <tr>
          <td>
		  <?php showCategoryMenu(); ?>
   </td>
     </tr>
    <tr>
        <td colspan=3 align=center>          
            <input type="submit" value="Add">
        </td>
    </tr>   
</table>
 </form>
 
 <?php 
           
		   		if(isset($_POST["title"]))
				{ 
                    $title=$_POST["title"];
					$category=$_POST["category"];
					$release_date=$_POST["releasedate"];
					$imagepath=$_POST["imagepath"];
					$review=$_POST["review"];
					$reg=register_game($title,$release_date,$category);
					if($reg==1)
						{
						echo "epituxia";
						}
					else if($reg==2)
						{
						echo "uparxei";
						}
					else if($reg==4)
						{
						echo "dose stoixeia";			
						}
					else if($reg==3)
						{
						echo "polu megalo onoma";			
						}
					
                }  
 ?>